﻿<Window x:Class="WPFMVVMApplcation.View.DetailsView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:WPFMVVMApplcation.View"
        WindowState="Normal"
        ResizeMode="NoResize"
        Title="WPF MVVM APP Details"
        WindowStartupLocation="CenterScreen"
        Height="300" Width="300">
    <DockPanel >
        <Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="20" DockPanel.Dock="Top">
            <Grid.Resources>
                <local:InvalidAgeConverter x:Key="InvalidAgeConverterKey" />
            </Grid.Resources>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <TextBlock Text="Name" Grid.Row="0" Grid.Column="0" Margin="0,0,10,20" />
            <TextBox Text="{Binding CurrentMember.Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Grid.Row="0" Grid.Column="1" Margin="0,0,0,15" />

            <TextBlock Text="Age" Grid.Row="1" Grid.Column="0" Margin="0,0,10,20"/>
            <TextBox Text="{Binding CurrentMember.Age, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource InvalidAgeConverterKey}}"
                     Grid.Row="1" Grid.Column="1" Margin="0,0,0,15"/>
        </Grid>
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right"  
                    VerticalAlignment="Bottom" Margin="10"
                    DockPanel.Dock="Bottom" Height="20">
            <Button Content="Save" Width="100"  Grid.Row="0" Grid.Column="1" HorizontalAlignment="Right"   Command="{Binding SaveCommand}" Margin="0,0,10,0"/>
            <Button Content="Cancel" Width="100"  Grid.Row="0" Grid.Column="1" HorizontalAlignment="Right" Command="{Binding CancelCommand}" />
        </StackPanel>
    </DockPanel>
</Window>
